<%@  language="JScript" %>
<script runat=server language=VBSCRIPT>
Public Function BinToHex(bytes)
	Dim bslen,i,b,l,h,chars,sb
	chars="0123456789ABCDEF"
	sb=""
	For i=1 To LenB(bytes)
		b=AscB(MidB(bytes,i,1))
		l=b Mod 16
		h=(b-l)/16
		sb = sb & Mid(chars,h+1,1) & Mid(chars,l+1,1)
	Next
	BinToHex=sb
End Function
</script>
<%
var type=Request.QueryString("type");
if(type=="culture")
{
	var file=Server.MapPath("Culture/en/lang.xml");
	var xml=new ActiveXObject("Microsoft.XMLDOM");
	xml.load(file);
	
	var sb=[];
	sb.push("var GalleryLocalize=new new Function();\r\n");
	sb.push("GalleryLocalize.TODO=function(str){return str;};\r\n");
	var ns=xml.documentElement.selectNodes("*");
	for(var i=0;i<ns.length;i++)
	{
		var n=ns.item(i);
		sb.push("GalleryLocalize.");
		sb.push(n.getAttribute("name"));
		sb.push("=\"");
		sb.push(n.text);
		sb.push("\";\r\n");
	}
	Response.Write(sb.join(""));
	Response.End();
}
if(type=="license")
{
	var filepath=String(Server.MapPath("."));
	filepath=filepath.split('\\');
	filepath.splice(filepath.length-1,1);
	filepath=filepath.join('\\');
	filepath=filepath+"\\license\\aspgallery.lic";
	
	var stream=new ActiveXObject("ADODB.Stream");
	stream.Type=1;
	stream.Mode=3;
	stream.Open();
	stream.LoadFromFile(filepath);
	var data=stream.Read(stream.Size);
	stream.Close();
	var hexdat=BinToHex(data);
	//Response.Write(hexdat);
	test111();
	Response.End();
}
%>
